package com.wennimei.dao;

import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

import com.wennimei.domain.Answer;

@DAO
public interface AADAO {

    @SQL("insert ignore into natural_language_q (id,question,add_time) values (:1,:2,now())")
    public void insertQuestion(long id, String question);

    @SQL("insert ignore into natural_language_a (answer,question_id,flag,add_time) values (:1,:2,1,now())")
    public void insertAnswer(String answer, long questionId);

    @SQL("select id,answer from natural_language_a where question_id = :1 and flag = 1")
    public List<Answer> getAnswer(long questionId);
    
    @SQL("select max(id) from natural_language_q")
    public Long max();
    
    @SQL("update natural_language_a set flag = 0  where id = :1")
    public void deleteAnswer(long id);
}
